package loads

import "jvmgo/ch05/instructions/base"
import "jvmgo/ch05/rtda"
/*
从局部变量表（LocalVars）加载到栈顶（stack.push）
*/
//load long from local variables
type LLOAD struct { base.Index8Instruction }

func (self *LLOAD) Execute(frame *rtda.Frame) {
	_lload(frame, self.Index)
}

type LLOAD_0 struct { base.NoOperandsInstruction }

func (self *LLOAD_0) Execute(frame *rtda.Frame) {
	_lload(frame, 0)
}

type LLOAD_1 struct { base.NoOperandsInstruction }

func (self *LLOAD_1) Execute(frame *rtda.Frame) {
	_lload(frame, 1)
}

type LLOAD_2 struct { base.NoOperandsInstruction }

func (self *LLOAD_2) Execute(frame *rtda.Frame) {
	_lload(frame, 2)
}

type LLOAD_3 struct { base.NoOperandsInstruction }


func (self *LLOAD_3) Execute(frame *rtda.Frame) {
	_lload(frame, 3)
}

//公用代码
func _lload(frame *rtda.Frame, index uint) {
	val := frame.LocalVars().GetLong(index)
	frame.OperandStack().PushLong(val)
}
